﻿#include "SdlWindow.h"

SdlWindow::SdlWindow(QWidget* parent)
	: QMainWindow(parent)
{
	this->resize(QSize(320, 480));
	this->setWindowTitle("FFMPEG");
	this->setWindowIcon(QIcon("images/opencv.png"));
	createListView();
}
void SdlWindow::createListView() {
	listView = new CommonListView(this);
	connect(listView, &CommonListView::itemClicked, [=](QListWidgetItem* item) {
		CommonListViewItem* item2 = dynamic_cast<CommonListViewItem*>(item);
		qDebug() << "itemPos:" << item2->mPos;
		switch (item2->mPos) {
		case 1:
			sdlRenderRGBWindow = new SDLRenderRGBWindow();
			sdlRenderRGBWindow->show();
			break;
		case 2:
			sdlRenderYUVWindow = new SDLRenderYUVWindow();
			sdlRenderYUVWindow->show();
			break;
		case 3://
			videoRenderViewWindow = new VideoRenderViewWindow();
			videoRenderViewWindow->show();
			break;
		case 4:
			sdlRenderAVFrameWindow = new SDLRenderAVFrameWindow();
			sdlRenderAVFrameWindow->show();
			break;
		}
		});
	new CommonListViewItem("SDL播放RGB文件", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 1, listView);
	new CommonListViewItem("SDL播放YUV文件", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 2, listView);
	new CommonListViewItem("SDL播放(ARGB、RGBA、RGB24、YUV420P)", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 3, listView);
	new CommonListViewItem("SDL+AVFrame播放两路不同格式的视频", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 4, listView);

}

SdlWindow::~SdlWindow()
{
}
